package com.katze.boot.common.task;

import com.katze.boot.plugins.redis.service.CacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 * 主要用于定时删除 Redis中 key为 febs.user.active 中
 * 已经过期的 score
 */
//@Component
@Deprecated
public class CacheTask {
    private static final Logger log = LoggerFactory.getLogger(CacheTask.class);

    @Resource
    private CacheService cacheService;

    @Scheduled(fixedRate = 3600000)
    public void run() {
        try {
            Long count = cacheService.clearInvalidActiveUser();
            log.info("delete expired user: {}", count);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
